#include<iostream>
#include<vector>
using namespace std;

void _MergeSort(vector<int>& v, int left, int right, vector<int> tmp)
{
	if (left >= right) return;
	int mid = (left + right) / 2;
	_MergeSort(v, left, mid, tmp);
	_MergeSort(v, mid + 1, right, tmp);
	int begin1 = left;
	int end1 = mid;
	int begin2 = mid + 1;
	int end2 = right;
	int i = left;
	while (begin1 <= end1 && begin2 <= end2)
	{
		if (v[begin1] < v[begin2])
			tmp[i++] = v[begin1++];
		else
			tmp[i++] = v[begin2++];
	}
	while (begin1 <= end1)
		tmp[i++] = v[begin1++];
	while (begin2 <= end2)
		tmp[i++] = v[begin2++];
	for (int j = left; j <= right; j++)
		v[j] = tmp[j];
}

void MergeSort(vector<int>& v)
{
	vector<int> tmp = v;
	_MergeSort(v, 0, v.size() - 1, tmp);
}


int main()
{
	vector<int> ans{ 4,3,10,2,44,334 };
	MergeSort(ans);
	for (auto x : ans) cout << x << " ";
	return 0;
}